//
//  InteractTableViewCell.m
//  AnXin100
//
//  Created by Sakura on 2018/10/31.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "InteractTableViewCell.h"

@interface InteractTableViewCell ()

@property (nonatomic, strong) UIImageView *userImage;

@property (nonatomic, strong) UILabel *nameLabel;

@property (nonatomic, strong) UILabel *timeLabel;

@property (nonatomic, strong) UILabel *contentLabel;

@end

@implementation InteractTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell {
    _userImage = [UIImageView new];
    _userImage.layer.cornerRadius = 27.5;
    _userImage.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_userImage];
    
    _nameLabel = [UILabel new];
    _nameLabel.textColor = [UIColor colorWithHex:0x333333];
    _nameLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:_nameLabel];
    _nameLabel.text = @"我们都是小怪兽";
    
    _timeLabel = [UILabel new];
    _timeLabel.textColor = [UIColor colorWithHex:0x666666];
    _timeLabel.font = [UIFont systemFontOfSize:14];
    _timeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_timeLabel];
    _timeLabel.text = @"2018/10/29";
    
    _contentLabel = [UILabel new];
    _contentLabel.textColor = [UIColor colorWithHex:0x333333];
    _contentLabel.font = [UIFont systemFontOfSize:14];
    _contentLabel.numberOfLines = 1;
    [self.contentView addSubview:_contentLabel];
    _contentLabel.text = @"阿里电视剧里看到阿里肯德基了肯德基阿拉基沙拉酱的来看啊速度加快阿萨德";
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _userImage.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(55)
    .heightIs(55);
    
    _nameLabel.sd_layout
    .topSpaceToView(self.contentView, 15)
    .leftSpaceToView(_userImage, 10)
    .heightIs(15)
    .widthIs(SCREEN_WIDTH  / 2);
    
    _timeLabel.sd_layout
    .topEqualToView(_nameLabel)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(15)
    .widthIs(100);
    
    _contentLabel.sd_layout
    .leftEqualToView(_nameLabel)
    .bottomSpaceToView(self.contentView, 14)
    .heightIs(15)
    .widthIs(self.width_sd - CGRectGetMaxX(_userImage.frame) - 30);
    
    

    
}



- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
